home *** CD-ROM | disk | FTP | other *** search
/ Aminet 43 / Aminet 43 (2001)(GTI - Schatztruhe)[!][Jun 2001].iso / Aminet / game / patch / WHD_PDroid90.lha / WHD_PDroid90 / Install < prev    next >
Text File  |  2001-04-06  |  8KB  |  333 lines

  1. ;================================================================================
  2. ; CONFIGURATION SECTION
  3.  
  4. (set #CFG_APPNAME "Paradroid90")
  5. (set #CFG_APPSLV  "P90HD")
  6. (set #CFG_APPGUI  "Paradroid90")
  7. (set #CFG_APPVER  "R0401.1")
  8. (set #CFG_APPCOPY "1999-2001")
  9.  
  10. ;================================================================================
  11.  
  12. ;------------------------------------------------------------------------------------
  13. ; Checks if given program is reachable via the path, if not abort install
  14. ;
  15. ; Entry:    #VP1 = name of program to search for
  16.  
  17. (procedure P_CheckRun (
  18.     (if (<> 0 (run (cat "Which " #VP1)))(
  19.         (abort
  20.             (cat
  21.                 "Could not find the program\n\n"
  22.                 "'" #VPROGRAM "'\n\n"
  23.                 "which is required to perform the installation!\n\n"
  24.                 "Please install the '" #VPROGRAM "' program ensuring that"
  25.                 " it is accessible on the path, then try the installation again."
  26.             )
  27.         )
  28.     ))
  29. ))
  30.  
  31.  
  32. ;------------------------------------------------------------------------------------
  33. ; Create installation directories if required
  34.  
  35. (procedure P_InstallDirs (
  36.     ;
  37.     ; Create data dir if required
  38.     ;
  39.     (if (<> 2 (exists #VDATDIR))(
  40.         (makedir #VDATDIR
  41.             (prompt "The directory '" #VDATDIR "' will now be created")
  42.             (help @makedir-help)
  43.             (confirm)
  44.         )
  45.     ))
  46. ))
  47.  
  48.  
  49. ;------------------------------------------------------------------------------------
  50. ; Determine and set information about version of game being installed
  51. ;
  52.  
  53. (procedure P_SetVersionInfo (
  54.     ; if the file exists, set version information
  55.     (if (<= #VVERINFA 0)(
  56.         (if (= 1 (exists #VDATFILE))(
  57.             ; determine version from CRC
  58.             (working "Determining game version")
  59.  
  60.             (set #VT1
  61.                 (run (cat "CRC16 \"" #VDATFILE "\" OFFSET=43520 LENGTH=299008"))
  62.             )
  63.  
  64.             (set #VVERINFA 0)
  65.             (if (= #VT1 25338) (set #VVERINFA 1))
  66.             (if (= #VT1  8950) (set #VVERINFA 1))
  67.         ))
  68.     ))
  69.  
  70.     ; get memory size version information
  71.     (if (< #VVERINFB 0)(
  72.         (set #VVERINFB
  73.             (askbool
  74.                 (prompt "Does your machine have more than 512Kb of chip (graphics) memory?")
  75.                 (default 0)
  76.                 (help @askchoice-help)
  77.             )
  78.         )
  79.     ))
  80. ))
  81.  
  82.  
  83. ;------------------------------------------------------------------------------------
  84. ; Make game data
  85.  
  86. (procedure P_InstallGame (
  87.     ;
  88.     ; Set path to game data file
  89.     ;
  90.     (set #VDATFILE (tackon #VDATDIR "Disk.1"))
  91.  
  92.     ;
  93.     ; Install data files if not found or unknown versions
  94.     ;
  95.     (P_SetVersionInfo)
  96.     (if (<= #VVERINFA 0)(
  97.         ;
  98.         ; Tell user what is happening
  99.         ;
  100.         (message
  101.             (cat
  102.                 "\n\n\nThe installer will now create the game data files\n"
  103.                 "Follow the prompts to insert the game disks when required\n\n"
  104.                 "Click 'Proceed' when ready."
  105.             )
  106.         )
  107.  
  108.         ;
  109.         ; Call the imager slave
  110.         ;
  111.         (working "Creating data files in '" #VDATDIR "'")
  112.  
  113.         (copyfiles
  114.             (prompt "Copying disk image creation slave")
  115.             (help @copyfiles-help)
  116.             (source "ISlave")
  117.             (dest #VDATDIR)
  118.             (nogauge)
  119.             (optional fail force)
  120.         )
  121.  
  122.         (set @execute-dir #VDATDIR)
  123.         (run (cat "RawDIC SLAVE=ISlave"))
  124.         (set @execute-dir #VOLDEXEDIR)
  125.  
  126.         (delete (tackon #VDATDIR "ISlave") (optional force))
  127.     ))
  128.  
  129.     ;
  130.     ; Check the main data file was created and
  131.     ; that we know this version of the game
  132.     ;
  133.     (P_SetVersionInfo)
  134.  
  135.     (if (= 0 #VVERINFA)
  136.         (abort
  137.             (cat    "\n*** UNKNOWN VERSION OF GAME! ***\n\n"
  138.                     "The installer does not recognise the version of the\n"
  139.                     "game that you are trying to install.\n\n"
  140.                     "Please contact the author for further information\n"
  141.             )
  142.         )
  143.     )
  144.  
  145.     (if (= -1 #VVERINFA)
  146.         (abort
  147.             (cat    "\n*** DATA FILES NOT CREATED! ***\n\n"
  148.                     "The installer could not extract the game data files.\n\n"
  149.                     "Please contact the author for further information\n"
  150.             )
  151.         )
  152.     )
  153. ))
  154.  
  155. ;------------------------------------------------------------------------------------
  156. ; Install WHDLoad slave program
  157.  
  158. (procedure P_InstallSlave (
  159.  
  160.     (working "Installing slave program")
  161.  
  162.     ; first, clean up previous installations
  163.     (set #VT1 (tackon #VDESTDIR "Paradroid90_HD"))
  164.     (if (= 1 (exists #VT1)) (delete #VT1 (optional force)) )
  165.  
  166.     (set #VT1 (tackon #VDESTDIR "Paradroid90_HD.info"))
  167.     (set #VT2 (tackon #VDESTDIR "Paradroid90.info"))
  168.     (if (= 1 (exists #VT2))
  169.         (if (= 1 (exists #VT1)) (delete #VT1 (optional nofail force)) )
  170.         (if (= 1 (exists #VT1)) (rename #VT1 #VT2) )
  171.     )
  172.  
  173.     (set #VT1 (tackon #VDESTDIR "ReadMe_1st"))
  174.     (if (= 1 (exists #VT1)) (delete #VT1 (optional force)) )
  175.  
  176.     (set #VT1 (tackon #VDESTDIR "ReadMe_1st.info"))
  177.     (if (= 1 (exists #VT1)) (delete #VT1 (optional force)) )
  178.  
  179.     ; copy slave program
  180.     (set #VT1 "Slave")
  181.     (if (>= #VVERINFA 0) (set #VT1 (cat #VT1 #VVERINFA)) )
  182.     (if (>= #VVERINFB 0) (set #VT1 (cat #VT1 #VVERINFB)) )
  183.     (if (>= #VVERINFC 0) (set #VT1 (cat #VT1 #VVERINFC)) )
  184.  
  185.     (copyfiles
  186.         (prompt "Copying slave program")
  187.         (help @copyfiles-help)
  188.         (source #VT1)
  189.         (newname #CFG_APPSLV)
  190.         (dest #VDESTDIR)
  191.         (nogauge)
  192.         (optional fail force)
  193.     )
  194.  
  195.     ; see if the user wants to replace their icon
  196.     (set #VT1 (cat #CFG_APPGUI ".info"))
  197.     (if (= 0 (exists (tackon #VDESTDIR #VT1)))(
  198.         ; no icon exists, quietly copy one in
  199.         (set #VT2 1)
  200.     )(
  201.         ; icon exists, ask user if they want to overwrite it
  202.         (set #VT2
  203.             (askbool
  204.                 (prompt (cat "Do you want to replace the \"" #CFG_APPGUI "\" program icon (recommended) ?"))
  205.                 (default 1)
  206.                 (help @askchoice-help)
  207.             )
  208.         )
  209.     ))
  210.  
  211.     ; do we have a slave icon?
  212.     (if (= 1 (exists "Slave.inf"))(
  213.         ; copy slave icon, renaming to proper name along the way
  214.         (if (= 1 #VT2)(
  215.             (copyfiles
  216.                 (prompt "Copying slave program icon")
  217.                 (help @copyfiles-help)
  218.                 (source "Slave.inf")
  219.                 (newname #VT1)
  220.                 (dest #VDESTDIR)
  221.                 (nogauge)
  222.                 (optional nofail force)
  223.             )
  224.         ))
  225.     )(
  226.         ; no slave icon so we must have a GUI to install
  227.         (copyfiles
  228.             (prompt "Copying GUI program")
  229.             (help @copyfiles-help)
  230.             (source  "GUI")
  231.             (newname #CFG_APPGUI)
  232.             (dest #VDESTDIR)
  233.             (nogauge)
  234.             (optional fail force)
  235.         )
  236.  
  237.         (if (= 1 #VT2)(
  238.             (copyfiles
  239.                 (prompt "Copying GUI program icon")
  240.                 (help @copyfiles-help)
  241.                 (source  "GUI.inf")
  242.                 (newname #VT1)
  243.                 (dest #VDESTDIR)
  244.                 (nogauge)
  245.                 (optional nofail force)
  246.             )
  247.         ))
  248.     ))
  249.  
  250. ))
  251.  
  252. ;------------------------------------------------------------------------------------
  253. (welcome (cat "Welcome to the " #CFG_APPNAME " HD Installer"))
  254.  
  255. ;
  256. ; Initialise
  257. ;
  258. (set @app-name #CFG_APPNAME)
  259. (set #VOLDEXEDIR @execute-dir)
  260. (set #VVERINFA -1)
  261. (set #VVERINFB -1)
  262. (set #VVERINFC -1)
  263. (set #VDESTDIR @default-dest)
  264.  
  265. ;
  266. ; Check settings
  267. ;
  268. (if    (<> @user-level 2)
  269.     (abort "You must select 'Expert' user level")
  270. )
  271.  
  272. (if    (< @installer-version 2818051)
  273.     (abort "This product requires at least version 43.3 of the Installer program")
  274. )
  275.  
  276. ;
  277. ; Check required programs are available
  278. ;
  279. (set #VP1 "CRC16")
  280. (P_CheckRun)
  281. (set #VP1 "RawDIC")
  282. (P_CheckRun)
  283. (set #VP1 "WHDLoad")
  284. (P_CheckRun)
  285.  
  286. ;
  287. ; Welcome message
  288. ;
  289. (message "\n\nWelcome to the " #CFG_APPNAME " HD Installer"
  290.          "\n© " #CFG_APPCOPY " John Girvin/Halibut Software\n\n"
  291.          "Please read the documentation thoroughly "
  292.          "before attempting to use this installer!\n\n"
  293.          "This is release " #CFG_APPVER "\n\n"
  294.          "Click 'Proceed' to begin..."
  295. )
  296.  
  297. ;
  298. ; Get directory to install in
  299. ;
  300. (set #VDESTDIR
  301.     (askdir
  302.         (prompt "Where would you like the game installed?\n"
  303.                 "If you have an existing installation select that directory,\n"
  304.                 "otherwise create / select the directory to install the game into."
  305.         )
  306.         (help @askdir-help)
  307.         (default @default-dest)
  308.         (disk)
  309.         (newpath)
  310.     )
  311. )
  312. (set #VDESTDIR (expandpath #VDESTDIR))
  313. (set @default-dest #VDESTDIR)
  314. (set #VDATDIR  (tackon #VDESTDIR "data/"))
  315.  
  316. ;
  317. ; Create the installation directories
  318. ;
  319. (P_InstallDirs)
  320.  
  321. ;
  322. ; Install the game data
  323. ;
  324. (P_InstallGame)
  325.  
  326. ;
  327. ; Install the slave
  328. ;
  329. (P_InstallSlave)
  330.  
  331. ;================================================================================
  332. ;$VER: Paradroid90 Installer script R0401.1 © 1999-2001 John Girvin/Halibut Software;================================================================================
  333.